#include <stdio.h>
#include <windows.h>
#include "software_timer.h"

void Timer_Test_0(uint32_t num)
{
    static uint32_t count = 0 ;  count ++ ; 
    printf("Timer_Test_0  num = %u  count = %u\n" , num , count) ;
}

void Timer_Test_1(uint32_t num)
{
    static uint32_t count = 0 ;  count ++ ; 
    printf("Timer_Test_1  num = %u  count = %u\n" , num , count) ;
    if(count == 10) {  Software_Timer_Stop_Id(1) ;}
}

void Timer_Test_2(uint32_t num)
{
    static uint32_t count = 0 ;  count ++ ; 
    printf("Timer_Test_2  num = %u  count = %u\n" , num , count) ;
    if(count == 5) {  Software_Timer_Stop_Function(Timer_Test_2) ;}
}

void Timer_Test_3(void)
{
    static uint32_t count = 0 ;  count ++ ; 
    printf("Timer_Test_3    count = %u\n" , count) ;
}

int main(void)
{
    int8_t timerId = -1 ;
    printf("hello word !\n") ;

    Software_Timer_Init() ;

    timerId = Software_Timer_Start(100 , Timer_Test_0 , 123 , 0xFFFF) ; printf("timerId = %d\n" , timerId) ;
    timerId = Software_Timer_Start(200 , Timer_Test_1 , 234 , 10) ; printf("timerId = %d\n" , timerId) ;
    timerId = Software_Timer_Start(400 , Timer_Test_2 , 345 , 10) ; printf("timerId = %d\n" , timerId) ;
    timerId = Software_Timer_Start(400 , Timer_Test_3 , 0 , 10) ; printf("timerId = %d\n" , timerId) ;

    while (1)
    {
        Sleep(5) ;
        Software_Timer_Update() ;
    }
    

    return 0 ;
}